package cn.kgc.mybatis.mapper;

import cn.kgc.mybatis.entity.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author: mosin
 * @version: v1.0  2022/6/20
 */
public interface StudentDao {

    @Select("select *  from student")
    List<Student> selectAll();

    @Insert("insert into student (stu_name,stu_no,stu_age,stu_sex)values(#{stuName},#{stuNo},#{stuAge},#{stuSex})")
    Integer addStudent(Student student);

    @Delete("delete from student where stu_no = #{stuNo}")
    Integer delete(String stuNo);

    @Update("update student set stu_age = #{stuAge} where stu_no = #{stuNo}")
    Integer update(Student student);

}
